package com.jiawa.train.batch.controller.admin;

import com.jiawa.train.common.resp.CommonResp;
import com.jiawa.train.batch.req.train_seatQueryReq;
import com.jiawa.train.batch.req.train_seatSaveReq;
import com.jiawa.train.batch.resp.PageResp;
import com.jiawa.train.batch.resp.train_seatQueryResp;
import com.jiawa.train.batch.service.train_seatService;
import jakarta.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/admin/train-seat")
public class train_seatAdminController {

    @Autowired
    private train_seatService train_seatService;

    @PostMapping("/save")
    public CommonResp<Object> save(@Valid @RequestBody train_seatSaveReq req) {
        train_seatService.save(req);
        return new CommonResp<>();
    }

    @GetMapping("/query-list")
    public CommonResp<PageResp<train_seatQueryResp>> queryList(@Valid  train_seatQueryReq req) {
        PageResp<train_seatQueryResp> list = train_seatService.queryList(req);
        return new CommonResp<>(list);
    }

    @DeleteMapping("/delete/{id}")
    public CommonResp<Object> delete(@PathVariable("id") Long id) {
        train_seatService.delete(id);
        return new CommonResp<>();
    }

}
